Next: Network Options, Up: Low-Level Network [Contents][Index]
make-network-processThe basic function for creating network connections and
network servers is make-network-process. It can do
either of those jobs, depending on the arguments you give it.
This function creates a network connection or server and
returns the process object that represents it. The arguments
args are a list of keyword/argument pairs.
Omitting a keyword is always equivalent to specifying it with
value nil, except for :coding,
:filter-multibyte, and :reuseaddr.
Here are the meaningful keywords (those corresponding to
network options are listed in the following section):
Use the string name as the process name. It is modified if necessary to make it unique.
Specify the communication type. A value of
nil specifies a stream connection (the
default); datagram specifies a datagram
connection; seqpacket specifies a sequenced
packet stream connection. Both connections and servers
can be of these types.
If server-flag is non-nil,
create a server. Otherwise, create a connection. For a
stream type server, server-flag may be an
integer, which then specifies the length of the queue of
pending connections to the server. The default queue
length is 5.
Specify the host to connect to. host should
be a host name or Internet address, as a string, or the
symbol local to specify the local host. If
you specify host for a server, it must specify
a valid address for the local host, and only clients
connecting to that address will be accepted.
service specifies a port number to connect
to; or, for a server, the port number to listen on. It
should be a service name that translates to a port
number, or an integer specifying the port number
directly. For a server, it can also be t,
which means to let the system select an unused port
number.
family specifies the address (and protocol)
family for communication. nil means
determine the proper address family automatically for the
given host and service.
local specifies a Unix socket, in which case
host is ignored. ipv4 and
ipv6 specify to use IPv4 and IPv6,
respectively.
For a server process, local-address is the address to listen on. It overrides family, host and service, so you might as well not specify them.
For a connection, remote-address is the address to connect to. It overrides family, host and service, so you might as well not specify them.
For a datagram server, remote-address specifies the initial setting of the remote datagram address.
The format of local-address or remote-address depends on the address family:
[a b c
d p] corresponding to
numeric IPv4 address
a.b.c.d and
port number p.[a
b c d e
f g h
p] corresponding to numeric IPv6
address
a:b:c:d:e:f:g:h
and port number p.(f . av), where
f is the family number and av is
a vector specifying the socket address using one
element per address data byte. Do not rely on this
format in portable code, as it may depend on
implementation defined constants, data sizes, and data
structure alignment.If bool is non-nil for a
stream connection, return without waiting for the
connection to complete. When the connection succeeds or
fails, Emacs will call the sentinel function, with a
second argument matching "open" (if
successful) or "failed". The default is to
block, so that make-network-process does not
return until the connection has succeeded or failed.
If stopped is non-nil, start
the network connection or server in the stopped
state.
Use buffer as the process buffer.
Use coding as the coding system for this
process. To specify different coding systems for decoding
data from the connection and for encoding data sent to
it, specify (decoding .
encoding) for coding.
If you don’t specify this keyword at all, the default is to determine the coding systems from the data.
Initialize the process query flag to query-flag. See Query Before Exit.
Initialize the process filter to filter.
If multibyte is non-nil,
strings given to the process filter are multibyte,
otherwise they are unibyte. The default is the default
value of enable-multibyte-characters.
Initialize the process sentinel to sentinel.
Initialize the log function of a server process to log. The log function is called each time the server accepts a network connection from a client. The arguments passed to the log function are server, connection, and message; where server is the server process, connection is the new process for the connection, and message is a string describing what has happened.
Initialize the process plist to plist.
The original argument list, modified with the actual
connection information, is available via the
process-contact function.
Next: Network Options, Up: Low-Level Network [Contents][Index]